﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ParieurPro.DAL;

namespace MyBet.Web.Controls
{
    public partial class UserStatus : System.Web.UI.UserControl
    {
        #region Properties
        public UserObject CurrentUser
        {
            get
            {
                if (Session["CurrentUser"] != null)
                {
                    return Session["CurrentUser"] as UserObject;
                }
                return null;
            }

            set
            {
                Session["CurrentUser"] = value;
            }
        }

        public String CurrentRank
        {
            get
            {
                if (CurrentUser != null)
                {
                    return CurrentUser.Rank.ToString();
                }
                return String.Empty;
            }
        }
        #endregion


        protected void Page_Load(object sender, EventArgs e)
        {
            this.LoginStatus.LoginText = "Se connecter";
            this.LoginStatus.LogoutText = "Se déconnecter";
        }

        protected void LoginStatus_LoggedOut(object sender, EventArgs e)
        {
            Session["CurrentUser"] = null;
        }

    }
}